package com.tansuo365.test1.controller.encryptcontrol;

import com.tansuo365.test1.util.EncryptUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/static")
public class EncryptController {

    @Autowired
    private EncryptUtil encryptUtil;

    @GetMapping("/getMiling")
    public Map<String, Object> getMIByMachineCode(@RequestParam("machineCode") String machineCode,
                                                  @RequestParam("license") String license) {
        Map<String, Object> resultMap = new HashMap<>();
        String miling = encryptUtil.encryptMD5BySalt(machineCode);
        if (miling.equals(license)) {
            resultMap.put("success", 1);
            resultMap.put("miling", miling);
            return resultMap;
        } else {
            resultMap.put("success", 0);
            return resultMap;
        }
    }
}
